package com.ffyc.cemp.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ffyc.cemp.domain.entity.Movie;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface IMovieMapper extends BaseMapper<Movie> {
    //基础的CRUD
    @Select("SELECT  *   FROM  movie_tab WHERE movie_stars LIKE #{stars}")
    List<Movie> findByStarsLike(String stars);

    @Select("SELECT  count(*) from  movie_tab WHERE movie_stars LIKE #{stars}")
    int findCountByStarsLike(String stars);

    @Select("SELECT movie_type name,count(*) value from movie_tab GROUP BY movie_type")
    List<Map<String,Object>> countMovieType();
}
